﻿using MHI.DeviceManager.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebFoundation.Data;

namespace MHI.DeviceManager.Data
{
    internal class DevLocationinfoTQueryDAO : QueriableDAO<DevLocationinfoT>
    {
        protected static DbManager _dbManager = WebFoundation.Data.DbManager.FromConfig("DefaultConnection");

        public DevLocationinfoTQueryDAO()
        : base(_dbManager)
        {
        }

        public DevLocationinfoTQueryDAO(DbManager db)
            : base(db)
        {
        }

		/// <summary>
		/// 获取所有DevLocationinfoT,table items:dev_locationinfo_t信息 
		/// </summary>
		/// <returns></returns>
		public IEnumerable<DevLocationinfoT> GetDevLocationinfoTAllItems()
		{
			var query = this.CreateQuery();
			query.Filter().Eq(r => r.IsUse, 1);
			return this.Query(query);
		}

		/// <summary>
		/// 根据parentId，获取所有DevLocationinfoT,table items:dev_locationinfo_t信息 
		/// </summary>
		/// <returns></returns>
		public IEnumerable<DevLocationinfoT> GetDevLocationinfoTItemsByParentId(int parentId)
		{
			var query = this.CreateQuery();
			query.Filter().Eq(r => r.ParentId, parentId);
			return this.Query(query);
		}
	}
}
